var AddRole = {};
AddRole.contextpath = "";
AddRole.initPage = function(contextpath) {
	AddRole.contextpath = contextpath;
	layui.use(['form', 'layedit'], function(){
		  var form = layui.form
		  ,layer = layui.layer
		  ,layedit = layui.layedit
		  //监听提交
		  form.on('submit(submit)', function(data){
			  AddRole.ajaxSaveRole(data);
		    return false;
		  });
		});
}


AddRole.ajaxSaveRole = function(data1) {
	Common.callClient("/web2019/user/ajaxSaveRole.action",data1.field,function(data){
		if (data.code == "0000") {
			layer.alert(data.message, { icon: 1, closeBtn: 0 }, function (index) { 
				layer.close(index);
				window.location.href="/web2019/user/addRole.action";
			});
		} else {
			layer.alert(data.message, { icon: 1, closeBtn: 0 }, function (index) { 
				layer.close(index);
			});
		}
	})
}
